﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using BidPreparation.dto;
using BidPreparation.service.impl;
using BidPreparation.service;
using System.Data.Odbc;
using MySql.Data.MySqlClient;
using BidPreparation.model;
using BidPreparation.entity;

namespace BidPreparation
{
    public partial class FormTbTool : Form
    {
        public FormTbTool()
        {
            InitializeComponent();
        }

        private void btnSearchOnClick(object sender, EventArgs e)
        {
            var bsService = new BidsectionSupplierService();
            var dt = bsService.getList();
            if (dt != null)
            {
                this.dataGridView1.DataSource = dt;
            }
        }

        private void btnGetIpOnClick(object sender, EventArgs e)
        {
            // 清空
            this.listBox1.Items.Clear();

            // 读取
            HostInfoService hostInfo = new HostInfoServiceImpl();
            var infoDict = hostInfo.GetHostInfo();
            if (infoDict != null)
            {
                foreach (var item in infoDict)
                {
                    this.listBox1.Items.Add(item);
                }
            }
        }

        private void btnSet_Click(object sender, EventArgs e)
        {
            TestDbContext context = new TestDbContext();
            TestUser user = new TestUser();
            user.nickName = "Test";
            user.Age= 30;
            context.Add(user);
            context.SaveChanges();
        }
    }
}
